package mysql

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	GoodsTitle  string  `gorm:"type:varchar(100);not null;index;comment:'商品标题'"`
	GoodsPrice  float64 `gorm:"type:decimal(10,2);default:0.00;comment:'商品价格'"`
	GoodsCover  string  `gorm:"type:varchar(255);not null;comment:'商品封面'"`
	GoodsStock  int     `gorm:"type:int;default:0;comment:'商品库存'"`
	GoodsStatus int     `gorm:"type:int(10);default:1;comment:'商品状态'"`
	LikeCount   int     `gorm:"type:int;default:0;comment:'点赞数'"`
}

func (g *Goods) Create() error {
	return DB.Create(&g).Error
}
